
#-------------------------------------------------------------------------------
# System dependent variables                                                    
#-------------------------------------------------------------------------------

OCAMLC = ocamlc -g
OCAMLOPT = ocamlopt
OCAMLDEP = ocamldep
OCAMLMKLIB = ocamlmklib
OCAMLMKTOP = ocamlmktop
OCAMLDOC = ocamldoc

# where to put documentation
DOC_DIR = doc

#-------------------------------------------------------------------------------
# Do not edit below this point                                                  
#-------------------------------------------------------------------------------

BASE 	= eqtype common cache ordered heap parse matrix pool
ML	:= $(addsuffix .ml, $(BASE))
MLI	:= $(addsuffix .mli, $(BASE))
CMO	:= $(addsuffix .cmo, $(BASE))
CMI	:= $(addsuffix .cmi, $(BASE))
CMX	:= $(addsuffix .cmx, $(BASE))

all : .depend lib.cma lib.cmxa

%.cmi : %.mli
	$(OCAMLC) -c $<

%.cmo : %.ml
	$(OCAMLC) -c $<

%.cmx : %.ml
	$(OCAMLOPT) -c $<

lib.cma : $(CMO) $(CMI)
	ocamlc -a -o $@ $(CMO)

lib.cmxa : $(CMX) $(CMI)
	ocamlopt -a -o $@ $(CMX)

doc : $(ML) $(MLI)
	$(OCAMLDOC) -html -colorize-code -d $(DOC_DIR) $(ML) $(MLI)

.depend: $(ML) $(MLI)
	$(OCAMLDEP) *.mli *.ml > .depend

clean :
	-rm -f *.cmi *.cmo *.cma *.cmx *.cmxa *.o *.a .depend

-include .depend

